    var childrens=[];
    var depChildrens=[];
	if(Array && Array.prototype && !Array.prototype.indexOf){
	  	Array.prototype.indexOf = function (searchElement, fromIndex) {
		    var k;
		    // 1. Let O be the result of calling ToObject passing
		    // the this value as the argument.
		    if (this == null) {
		      throw new TypeError('"this" is null or not defined');
		    }
		    var O = Object(this);
		    // 2. Let lenValue be the result of calling the Get
		    // internal method of O with the argument "length".
		    // 3. Let len be ToUint32(lenValue).
		    var len = O.length >>> 0;
		    // 4. If len is 0, return -1.
		    if (len === 0) {
		      return -1;
		    }
		    // 5. If argument fromIndex was passed let n be
		    // ToInteger(fromIndex); else let n be 0.
		    var n = +fromIndex || 0;
		    if (Math.abs(n) === Infinity) {
		      n = 0;
		    }
		    // 6. If n >= len, return -1.
		    if (n >= len) {
		      return -1;
		    }
		    // 7. If n >= 0, then Let k be n.
		    // 8. Else, n<0, Let k be len - abs(n).
		    // If k is less than 0, then let k be 0.
		    k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
		    // 9. Repeat, while k < len
		    while (k < len) {
		      // a. Let Pk be ToString(k).
		      // This is implicit for LHS operands of the in operator
		      // b. Let kPresent be the result of calling the
		      // HasProperty internal method of O with argument Pk.
		      // This step can be combined with c
		      // c. If kPresent is true, then
		      // i. Let elementK be the result of calling the Get
		      // internal method of O with the argument ToString(k).
		      // ii. Let same be the result of applying the
		      // Strict Equality Comparison Algorithm to
		      // searchElement and elementK.
		      // iii. If same is true, return k.
		      if (k in O && O[k] === searchElement) {
		        return k;
		      }
		      k++;
		    }
		    return -1;
	  	};
	}

	$.getUrlParams = function(name) {
			name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
			var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
			results = regex.exec(location.search);
			return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
	};
	
	var _lk  = 'http://203.0.65.5:8080/ws/ext.jsp?AJBS={0}';
	var _ws  = 'http://203.0.65.3:8080/zjgy_kpi_new/DownLoad.jsp?AJBS={0}&table=';
	var _se  = 'search.jsp';
	var _ks  = { 'docs' : '案件', 'pages' : '网页' ,'population' : '人口','associated' : '关联案件','video':'视频','achievement':'业绩档案','paper':'法院报','more':'更多'
		,"practical":"实用信息","assisttool":"辅助工具","manual":"实务手册","lawsRegulations":"法律法规"
	};
	var _vpo = { };
	var _vps = [ 'q', 'k', 'b', 'p', 'v' ];
	var _mnl = 8;
	
	for(var _i = 0; _i < _vps.length; _i++) {
			var _k = _vps[_i];
			var _v = $.getUrlParams(_k);
			if(!_v || _v == 'null' || _v == '') {
					// continue;
			} else {
					_vpo[_k] = _v;
			}
	}
	
	var getPageUrl = function( vpo ) {
			vpo = vpo || {};
			if(_vpo) {
				for(var _i = 0; _i < _vps.length; _i++) {
						var _k = _vps[_i];
						if ( '' == vpo[_k]) {
								delete vpo[_k];
						} else if(_vpo[_k] && !vpo[_k]) {
								vpo[_k] = _vpo[_k];
						}
				}
			}
			var arr = [];
			for(_k in vpo) {
					// console.log(vpo);
					arr.push(_k + '=' + vpo[_k]);
			}
			if((arr.join('&')).indexOf("practical")>-1 || (arr.join('&')).indexOf("assisttool")>-1){
				
			}else {
				return '?' +  arr.join('&');
			}
	};

	var autoSize = function() { };
	
	var unfold = function(tdId) {
		var unfoldTB = document.getElementById("unfoldtable");
		var str=unfoldTB.getElementsByTagName("tr");//获取检索内容块
		 for(var i=0;i<str.length;i++){
			 if(str[i].className=="unfoldTR"){
				 str[i].style.display="none";
			 }
		 }		
		
		var unfoldTR = document.getElementById(tdId);
		
		
		unfoldTR.style.display = "";
//		unfoldTR.value = "";
	};
	
	var autoZoom = function() {
			var b = $('body');
			if(b.hasClass('nm')) {
					b.removeClass('nm');
					b.addClass('rs');
			}
			if(autoSize) (autoSize)();
	};

	// with any q
	if(_vpo && _vpo.q ) {
			$('body').addClass('rs');
			var page = function(data) {
				
				
				if(_vpo.k && _vpo.k.indexOf('population')>-1){
					var nodes = [];
					var jsonData = eval("(" + data + ")");
					var personList=jsonData.personList;
					for (var i = 0; i < personList.length; i++) {
						var result=personList[i];
						var u = getPageUrl({'q': result.Icno,'k':'docs'});
						nodes.push('<div style="display:inline;margin-top:5px;margin-left:5px;"><dl>'
								+'<dt>'+"姓名："+result.Name);
						var hasAsso='';
						$.ajax({
							url:'population.jsp',
							method:'post',
							data:'icno='+result.Icno,
							dataType:'json',
							async:false,
							success:function(data){
								if(null != data.icno && "" != data.icno && data.icno>0){
									hasAsso ='<a href="'+u+'" class="lk">关联案件（'+data.icno+'）</a>';
								}
							}
						});
						nodes.push(hasAsso);
						nodes.push('</dt>');
						nodes.push('<dd><table width="400px"style="text-align:center"><tr><th>性别</th><th>地区</th><th>身份证</th><th>民族</th></tr>'
								+'<tr><td>'+result.Sex+'</td><td>'+result.Region+'</td>'
								+'<td>'+result.Icno+'</td><td>'+result.Nation+'</td></tr></table></dd>');
						
						nodes.push('</dl></div>');
					}
					$('.sr-page').html( '<div>' + nodes.join("\n") + '</div>');
				}else if(_vpo.k && _vpo.k.indexOf('typical')>-1){
					var nodes = [];
					var jsonData = eval("(" + data + ")");
					var caseList=jsonData.caseList;
					for (var i = 0; i < caseList.length; i++) {
						var result=caseList[i];
						var title = result.Title;
						title = title.replace(new RegExp('</b>','gm'),'</em>');
						title = title.replace(new RegExp('<b>','gm'),'<em>');
						var  subContext= result.Context.substring(0,300);
						var q = _vpo.q.toString();
						for(var j=0;j<q.length;j++){
							var newStr='<em>'+q[j]+'</em>';
							var oldStr=q[j];
							subContext = subContext.replace(new RegExp(oldStr,"gm"),newStr);
						}
						nodes.push(
							'<dl>' + '<dt><a href="' + result.Url + '" target="_blank" class="titl"><b>' + title + '</b></a></dt>'  
							+ '<dt class="hl">' + subContext + '</dt>'
							+ '<dt class="caurl">' + result.Url + '</dt>'
							+ '</dl>');
					}
					$('.sr-page').html( '<div>' + nodes.join("\n") + '</div>');
				}else if(_vpo.k && _vpo.k.indexOf('manual')>-1){
					var nodes = [];
					var jsonData = eval("(" + data + ")");
					var manualList=jsonData.manualList;
					for (var i = 0; i < manualList.length; i++) {
						var result=manualList[i];
						var title = result.Book;
						title = title.replace(new RegExp('</b>','gm'),'</em>');
						title = title.replace(new RegExp('<b>','gm'),'<em>');
						var  fulltext= result.Fulltext.substring(0,250);
						var  chapter= result.Chapter;
						var  piece= result.Piece;
						var q = _vpo.q.toString();
						for(var j=0;j<q.length;j++){
							var newStr='<em>'+q[j]+'</em>';
							var oldStr=q[j];
							fulltext = fulltext.replace(new RegExp(oldStr,"gm"),newStr);
						}
						nodes.push(
							'<dl>' + '<dt><a href="#" target="_blank" class="titl"><b>' + title + '</b></a></dt>'  
							+ '<dt class="hl">' + piece + '</dt>');
						if(chapter!=null){
							nodes.push('<dt class="hl">' + chapter + '</dt>');
						}
						nodes.push('<dt class="hl">' + fulltext + '</dt>'
							+ '</dl>');
					}
					$('.sr-page').html( '<div>' + nodes.join("\n") + '</div>' );
				}else if(_vpo.k && _vpo.k.indexOf('lawsRegulations')>-1){
					var nodes = [];
					var jsonData = eval("(" + data + ")");
					var elementList=jsonData.elementList;
					for (var i = 0; i < elementList.length; i++) {
						var result=elementList[i];
						var title = result.Title;
						var  content= result.Content.substring(0,250);
						var  href= result.Href;
						var q = _vpo.q.toString();
						for(var j=0;j<q.length;j++){
							var newStr='<em>'+q[j]+'</em>';
							var oldStr=q[j];
							content = content.replace(new RegExp(oldStr,"gm"),newStr);
						}
						nodes.push(
							'<dl>' + '<dt><a href="'+href+'" target="_blank" class="titl"><b>' + title + '</b></a></dt>'  
							+ '<dt class="hl">' + content + '</dt>'
							+ '<dt class="caurl">' + href + '</dt>'
							+ '</dl>');
					}
					$('.sr-page').html( '<div>' + nodes.join("\n") + '</div>' );
				}else if(_vpo.k && _vpo.k.indexOf('paper')>-1){//150721 jinxin add
					var nodes = [];
					var jsonData = eval("(" + data + ")");
					//alert(jsonData);
					var elementList=jsonData.elementList;
					for (var i = 0; i < elementList.length; i++) {
						var result=elementList[i];
						var title = result.title;
						var content=result.content;
//						var  content;
//						if(result.content.length>250){
//							content= result.content.substring(0,250);
//						}else{
//							content= result.content;
//						}
						
						var  href= "ElsSearchPaperDetail?id="+result.id;
						var q = _vpo.q.toString();
//						for(var j=0;j<q.length;j++){
//							var newStr='<em>'+q[j]+'</em>';
//							var oldStr=q[j];
//							content = content.replace(new RegExp(oldStr,"gm"),newStr);
//						}
						nodes.push(
								'<dl><dt><a style="cursor:pointer;" onclick="detail('+result.id+');" target="_blank" class="titl"><b>' + title + '</b></a></dt>'  
									+ '<dt class="hl">' + content + '</dt></dl>');
					}
					//alert(nodes);
					$('.sr-page').html( '<div><div style="margin-top:5px;margin-right:5px;">' + nodes.join("\n") + '</div></div>' );
					
					
					
					
					
				}else if(_vpo.k && _vpo.k.indexOf('achievement')>-1){
					
					var tbodytr="";
//					var nodes = [];
					var jsonData = eval("(" + data + ")");
					var elementList=jsonData.elementList;
					
					var table1="<table width='100%'><tr height='50px'>"
						+"<td style='width:18%;font-size: 14px;text-align: center'>档案业绩统一检索</td>"
						+"<td style='width:10%;font-size: 14px;text-align: center'><a href='./?q="+_vpo.q+"&k=achievement'>列表显示</a></td>"
						+"<td style='width:13%;font-size: 14px;text-align: center'><a href='./?q="+_vpo.q+"&k=achievementcard'>详细信息显示</a></td>"
						+"<td></td>"
						+"<td style='width:40%;font-size: 14px;text-align: right;display:none;'>"
							+"<button style='margin-right: 1%;border-color: #D6D6D4;border-width: 1px;color: #00A48B;background-color: #ffffff;border-radius: 5px;height: 22px;width: 80px;'>按收案数</button>"
							+"<button style='margin-right: 1%;border-color: #D6D6D4;border-width: 1px;color: #00A48B;background-color: #ffffff;border-radius: 5px;height: 22px;width: 80px;'>按结案数</button>"
							+"<button style='margin-right: 1%;border-color: #D6D6D4;border-width: 1px;color: #00A48B;background-color: #ffffff;border-radius: 5px;height: 22px;width: 90px;'>按未结案数</button>"
						+"</td><td style='width:13%;font-size: 14px;text-align: letf;display:none;'>"
							+"<select style='margin-left: 1%;width:80px;height:20px;'><option value='1' selected=''>按年份</option></select>"
						+"</td>"
						+"</tr></table>";
					
					
					if(_vpo.k.indexOf('card')>-1){//详细信息显示
						var divList="";
						for (var i = 0; i < elementList.length; i++) {
							if(i>=3){
								break;
							}
							var result=elementList[i];
//							var tdId='unfoldTR'+i;
							var occlevel = result.Occlevel;
							divList+='<div style="height:520px;width:31.7%;float: left;border: 1px solid #EEEEEC;margin: 15px 0 10px 1%;">'
//								+'<ul style="width: 92%;"><li style="text-align: center;padding: 12px;border-bottom: 1px solid #dddddd;"><img src="./images/touxiangbak.jpg"/><br/>'+result.Name+'</li>'
								+'<ul style="width: 92%;"><li style="text-align: center;padding: 12px;border-bottom: 1px solid #dddddd;"><img class="head" src="./picture/'+result.Code+'.jpg"/><br/>'+result.Name+'</li>'
//								+'<li><input type="submit" value="加入收藏" class="scbutton"></li>'
								+'<li style="margin-top:20px"><span class="title">所在法院 :</span> '+result.Court+'</li>'
								+'<li><span class="title">工作部门 :</span> '+result.Dep+'</li>'
								+'<li><span class="title">审判职称 :</span> '+result.Proftitle+'</li>'
								+'<li><span class="title">学历学位 :</span> '+result.Degree+'</li>'
								+'<li><span class="title">政治面貌 :</span> '+result.Polstatus+'</li>'
								+'<li><span class="title">职级 :</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '+occlevel+'</li>'
								+'<li><span class="title">行政职务 :</span> '+result.Job+'</li>'
								+'<li><span class="title">在职情况 :</span> '+result.Jobsituation+'</li>'
								+'<li><span class="title">职务类别 :</span> '+result.Jobtype+'</li>'
								+'<li style="border-bottom: 1px solid #dddddd;"><span class="title">出生年月 :</span> '+result.Birth+'</li>'
								+'<li>'
								+'<ul><li><ul style="float: left;text-align: center;width: 25%;"><li><img src="./images/jnsas.png"/></li><li><span>'+result.Casenum+'</span></li></ul>'
								+'<ul style="float: left;text-align: center;width: 25%;"><li><img src="./images/jnjas.png"/></li><li><span>'+result.Endcase+'</span></li></ul>'
								+'<ul style="float: left;text-align: center;width: 25%;"><li><img src="./images/jnwjs.png"/></li><li><span>'+result.Incase+'</span></li></ul>'
								+'<ul style="float: left;text-align: center;width: 25%;"><li><img src="./images/zbass.png"/></li><li><span>'+result.Casetotal+'</span></li></ul></li>'
								+'</div>';
						}
						var yjdacover='<div class="yjdacover" style="left: 10px;background-image:url(./images/left.png);" onmousemove="showCover()" onmouseout="hideCover()" title="'+(jsonData.currentPage-1)+'" onclick="achievementSearch(this)"></div><div class="yjdacover" style="right: 1.5%;background-image:url(./images/right.png);"  onmousemove="showCover()" onmouseout="hideCover()" title="'+(jsonData.currentPage+1)+'" onclick="achievementSearch(this)"></div>';
						
						$('.sr-page').html( '<div class="yjda1" style="height:50px;">' + table1 + '</div><div class="yjda2">' + divList + '</div>'+yjdacover );
					}else{	//列表显示
					for (var i = 0; i < elementList.length; i++) {
						var result=elementList[i];
						var tdId='unfoldTR'+i;
						var occlevel = result.Occlevel;
						tbodytr+='<tr onclick="unfold(\''+tdId+'\');">'
							+'<td>'+result.Name+'</td>'
							+'<td>'+result.Court+'</td>'
							+'<td>'+result.Dep+'</td>'
							+'<td>'+result.Proftitle+'</td>'
							+'<td>'+result.Degree+'</td>'
							+'<td>'+result.Polstatus+'</td>'
							+'<td>'+occlevel+'</td>'
							+'<td>'+result.Job+'</td>'
							+'<td>'+result.Jobsituation+'</td>'
							+'<td>'+result.Jobtype+'</td>'
							+'<td>'+result.Birth+'</td>'
							+'</tr>';
						tbodytr+='<tr style="display: none;background-color: #F2FBFA;" id="'+tdId+'" class="unfoldTR">'
							+'<td colspan=2><img class="lHead" src="./picture/'+result.Code+'.jpg"/></td>'
							+'<td colspan=9><ul style="float: left;margin-right: 1%"><li><img src="./images/jnsa.png"/></li><li><span>'+result.Casenum+'</span></li></ul>'
							+'<ul style="float: left;margin-right: 1%"><li><img src="./images/jnja.png"/></li><li><span>'+result.Endcase+'</span></li></ul>'
							+'<ul style="float: left;margin-right: 1%"><li><img src="./images/jnwj.png"/></li><li><span>'+result.Incase+'</span></li></ul>'
							+'<ul style="float: left;margin-right: 1%"><li><img src="./images/zbas.png"/></li><li><span>'+result.Casetotal+'</span></li></ul></td>'
							+'</tr>';
					}
					var table2="<table id='unfoldtable' width='100%' style='border: 10px solid #ffffff;  border-spacing:0px;'><tr>"
						+"<th>姓名</th><th>所在法院</th><th>工作部门</th><th>审判职称</th><th>学历学位</th><th>政治面貌</th><th>职级</th><th>行政职务</th><th>在职情况</th><th>职务类别</th><th>出生年月</th>"
						+"</tr>"
						+tbodytr
						+"</table>";
					$('.sr-page').html( '<div class="yjda1" style="height:50px;">' + table1 + '</div><div class="yjda2">' + table2 + '</div>' );
					}
				}else if(_vpo.k && _vpo.k.indexOf('elscpws')>-1){
					var jsonData = eval("(" + data + ")");
					refreshElscpws(jsonData);
					createDiv(jsonData);
				}
				else if(_vpo.k && _vpo.k.indexOf('alipay')>-1){
					var nodes = [];
					nodes.push(
							'<table width="100%"><thead><th>身份证</th><th>姓名</th><th>地址</th><th>电话</th></thead>');
					var jsonData = eval("(" + data + ")");
					var elementList=jsonData.elementList;
					var msg=jsonData.msg;
					for (var i = 0; i < elementList.length; i++) {
						var result=elementList[i];
						var name = result.name;
						var id=result.id;
						var addr=result.addr;
						var tel=result.tel;
						
						if(id!=null){
						nodes.push(
								'<tr><td>'+id+'</td><td>'+name+'</td><td>'+addr+'</td><td>'+tel+'</td></tr>');

						}else {
							nodes.push('<tr><td colspan="4">'+msg+'</td></tr>');
						}
					}
					nodes.push('</table>');
					//alert(nodes);
					$('.sr-page').html( '<div class="yjda2">' + nodes.join("\n") + '</div>' );
					
					
				}else if(_vpo.k && _vpo.k.indexOf('report')>-1){

					var jsonData = eval("(" + data + ")");
					refreshReport(jsonData);
					
				}else{
					var nodes = [];
					var _n = _ks['docs'];	//"案件"
					if(_vpo.k && _vpo.k.indexOf('pages') == 0) {
						_n = _ks['pages'];	//"网页"
					}else if(_vpo.k && _vpo.k.indexOf('population') == 0) {
						_n = _ks['population'];	//"人口"
					}
					var cas = data.data;
					var hls = data.highlighting; 
					for(var i =0; i < cas.length; i++) {
						
						var ca = cas[i];
						if(ca['id'] && ca['docid'] && ca['caseid']) {
							var hl = '';
							if(hls[ca['id']]['content']) hl = hls[ca['id']]['content'].join('<br />');
							var light_caseid = ca['caseid'];	//裁判文书标题
							//对标题进行高亮
							var arr_vpoQ = _vpo.q.toString().split(" ");
							for(var arr_i=0;arr_i<arr_vpoQ.length;arr_i++){
								light_caseid = light_caseid.replace(arr_vpoQ[arr_i],'<em>'+arr_vpoQ[arr_i]+'</em>' );
							}
							//高亮结束
							var lk = _n + ':' +  light_caseid;	//标题
							
							var oaOk = isOaOk ? isOaOk() : false;
							if(ca['judgetype'] && ca['judgetype'].indexOf('摘要') > -1) {
								// TODO
								if (oaOk) { 
									lk ='<b>'+lk+ '</b><a href="nopermissions.jsp?caseId='+ca['docid']+'"" target="_blank" class="lk">案件信息</a>';
									//lk ='<b>'+lk+ '</b>&nbsp;<a href="' + _lk.replace('{0}',ca['docid'])  + '" style="margin-left: 100px;color:#00898a;font-size:15px;text-decoration:none;" target="_blank" class="lk">案件信息</a>'
								}
							} else {
								//_ws是链接地址，将{0}更换为caseid即是有效链接地址
								lk = '<a href="' + _ws.replace('{0}',ca['docid']) + '" target="_blank" class="ws">' + _n + ':' +  light_caseid + '</a>'; 
								if (oaOk) {
									//lk += '&nbsp;<a href="' + _lk.replace('{0}',ca['docid'])  + '" style="margin-left: 100px;color:#00898a;font-size:15px;text-decoration:none;" target="_blank" class="lk">案件信息</a>' ;
									lk += '<a href="nopage.jsp?caseId='+ca['docid']+'" target="_blank" class="lk">庭审视频</a>' ;
									lk += '<a href="nopermissions.jsp?caseId='+ca['docid']+'" target="_blank" class="lk">案件信息</a>' ;
									
								}
							}
							// console.log(ca);
							nodes.push(
								'<dl>' + '<dt>' + lk + ' </dt>'  + '<dd>' + hl + '</dd>' + '</dl>'	
							);
						} else if(ca['id'] && ca['url']) {
							var caurl = ca['url'];
							var caurl_len = caurl.length;
							if(caurl_len>30){
								caurl = caurl.substring(0,30)+"...";
							}
							// var hl = hls[ca['id']]['content'].join('<br />');
							var hl = '';
							if(hls[ca['id']]['content']){
								hl = hls[ca['id']]['content'].join('<br />');
							} else {
								if(ca['content'].length>600){
									hl = ca['content'].substring(500,700);
								}else {
									hl = ca['content'].substring(0, 200);
								}
							}
							if(ca['url'].indexOf('doc')>-1){
								ca['title']='文档下载';
							}
							var light_title = ca['title'];
							var arr_vpoQ = _vpo.q.toString().split(" ");
							for(var arr_i=0;arr_i<arr_vpoQ.length;arr_i++){
								light_title = light_title.replace(arr_vpoQ[arr_i],'<em>'+arr_vpoQ[arr_i]+'</em>' );
							}
							
							nodes.push(
								//'<dl>' + '<dt><a href="' + ca['url'] + '" target="_blank">' + _n + ':' +  ca['url'] + '</a></dt>'  + '<dd>' + hl + '</dd>' + '</dl>'	
									'<dl>' + '<dt><a href="' + ca['url'] + '" target="_blank" class="titl"><b>' + light_title + '</b></a></dt>'  
									+ '<dt class="hl">' + hl + '</dt>'
									+ '<dt class="caurl">' + caurl + '</dt>'
									+ '</dl>'
									
								//'<dl>' + '<dt><a href="' + ca['url'] + '" target="_blank">' + _n + ':' +  utf8to16(base64decode(ca['title'])) + '</a></dt>'  + '<dd>' + hl + '</dd>' + '</dl>'	
							);
						}
					}
					$('.sr-page').html( '<div><div style="margin-top:5px;margin-right:5px;">' + nodes.join("\n") + '</div></div>' );
				}
			};
			
			var test = function() {
				var selectObj = document.getElementById('select');
				var u = getPageUrl({'p': selectObj.value});
				window.location.href=u;
//				alert(selectObj.value);
			};
			
			var navi = function(data) {
				if(_vpo.k && (_vpo.k.indexOf('typical')>-1 || _vpo.k.indexOf('manual')>-1 || _vpo.k.indexOf('achievement')>-1 
						|| _vpo.k.indexOf('population')>-1 || _vpo.k.indexOf('lawsRegulations')>-1|| _vpo.k.indexOf('elscpws')>-1|| _vpo.k.indexOf('paper')>-1)
						||_vpo.k.indexOf('report')>-1){
					var jsonData = eval("(" + data + ")");
					refresh3(jsonData);
				}else {
					var e = Math.floor(data['end_index']);
					var x = (e > 100) ? 8 : 8;
					var g = Math.ceil( x / 2 );
					var cur = Math.floor( $.getUrlParams('p') ) || data['current_page'];
					var nodes = [];
					var selectnodes = [];
					selectnodes.push('<select id="select" onchange="test()">');
					if(data['has_previous']) {
						var u = getPageUrl({'p': data['previous_page_number'] });
						nodes.push('<a href=\'' + u + '\'><span>上一页</span></a>');
					}
//					var a = Math.ceil( e / x );
					var b = Math.floor( (cur - 1) / x );
					var s = b * x;
					var y = s + x;
					if( cur > g && e > (x + g) ) {
						s = cur - g;
						y = s + x;
					}
					for( var c = s; c < y; c++) {
						var p = c + 1;
						var u = getPageUrl({'p': p});
						if( p > e ) {
							break;
						}
						if( (p % x) == (cur % x)  ) {
							nodes.push('<span>' + p + '</span>');
						} else {
							nodes.push('<a href=\'' + u + '\'><span>' + p + '</span></a>');
						}
					}
					if(data['total-docs']%10>0){
						for(var d=1;d<(data['total-docs']/10+1);d++){
							
							if(d==data['current_page']){
								selectnodes.push('<option value="'+d+'" selected>'+d+'</option>');
							}else{
								selectnodes.push('<option value="'+d+'">'+d+'</option>');
							}
						}
					}else{
						for(var d=1;d<(data['total-docs']/10);d++){
							if(d==data['current_page']){
								selectnodes.push('<option value="'+d+'" selected>'+d+'</option>');
							}else{
								selectnodes.push('<option value="'+d+'">'+d+'</option>');
							}
						}
					}
					selectnodes.push('</select>');
					// if(data['current_page'] < data['end_index']) {
					if(data['has_next']) {
						var u = getPageUrl({'p': data['next_page_number']});
						nodes.push('<a href=\'' + u + '\'><span>下一页</span></a>');
					}
					
					$('.sr-navi').html(//showChronological()+
							'<div>显示第'+selectnodes.join("\n")+'页 ' + nodes.join("\n") + ' <span>统一检索 为您找到' + data['total-docs'] + '条记录</span> </div>'
							);
				}
			};
			
			var aggsSearch = function(aggs){
				var data=[];
				var text = _vpo.q.toString();
				
				var groups=['Region'];
				
				var children=[];
				var json={'Name':aggs.title};
				children[0]=json;
				
				childrens[0]=children[0];
				
				data[0]={'Name':groups[0],'Children':children};
				var str='';
				if(aggs.title){
					str={'qString':text,'categories': JSON.stringify(data)};
				}else{
					str={'qString':text};
					var cs=[];
					childrens=cs;
				}
				
				$.ajax({
					url:context+'/ElsSearchAggs',
					method:'post',
					data:str,
					dataType:'json',
					async:false,
					success:function(data){
						refresh1(data);
						refresh2(data);
						refresh3(data);
					}
				});
			};
			var cpwsAggsSearch = function(aggs){
				var data=[];
				var text = _vpo.q.toString();
				
				
//				var children=[];
//				var json={'Name':aggs.title};
//				children[0]=json;
//				childrens[0]=children[0];
//				data[0]={'Name':$(aggs).closest("ul").attr("category"),'Children':children};
				if($(aggs).html().indexOf("返回上层")>0){
					$(aggs).closest("ul").find("li[menuChecked='true']").attr("menuChecked","false");
				}else{
					$(aggs).closest("li").attr("menuChecked","true");
				}
				var index=0;
				$("li[menuChecked='true']").each(function(){
					var _this=this;
					var category=$(_this).closest("ul").attr("category");
					var title=$(_this).find("a").attr("title");
					data[index]={'Name':category,'Children':[{'Name':title}]};
					index++;
				});
				
				var str='';
//				alert(JSON.stringify(data));
//				if(aggs.title){
					str={'qString':text,'categories': JSON.stringify(data)};
//				}else{
//					str={'qString':text};
//					var cs=[];
//					childrens=cs;
//				}
				
				$.ajax({
					url:context+'/ElsSearchCpws',
					method:'post',
					data:str,
					dataType:'json',
					async:false,
					success:function(data){
						refreshElscpws(data);
						menuElscpws(data);
						refresh3(data);
						createDiv(data);
					}
				});
			};
			var depSearch = function(dep){
				var data=[];
				var text = _vpo.q.toString();
				
				var groups=['Dep'];
				
				var children=[];
				var json={'Name':dep.title};
				children[0]=json;
				
				depChildrens[0]=children[0];
				
				data[0]={'Name':groups[0],'Children':children};
				var str='';
				if(dep.title){
					str={'qString':text,'categories': JSON.stringify(data)};
				}else{
					str={'qString':text};
					var cs=[];
					depChildrens=cs;
				}
				
				$.ajax({
					url:context+'/ElsSearchAchievement',
					method:'post',
					data:str,
					dataType:'json',
					async:false,
					success:function(data){
						refresh7(data);
						refresh2(data);
						refresh3(data);
					}
				});
			};
			var pageSearch = function(page){
				if(!page.title){
					var selectObj = document.getElementById('select');
					selPageNum=selectObj.value;
				}
				var data=[];
				var text = _vpo.q.toString();
				var pageNum=1;
				if(!page.title){
					var selectObj = document.getElementById('select');
					pageNum=selectObj.value;
				}else{
					pageNum=page.title;
				}
				var groups=['Region'];
				data[0]={"Name":groups[0],"Children":childrens};
				var str={'qString':text,'categories': JSON.stringify(data),'page':pageNum};
				$.ajax({
					url:context+"/ElsSearchAggs",
					method:"post",
//					data:{'qString':text,'categories': JSON.stringify(data),'page':30},
					data:str,
					dataType:'json',
					async:false,
					success:function(data){
						refresh1(data);
						refresh2(data);
						refresh3(data);
					}
				});
			};
			var reportSearch = function(paper){
				if(!paper.title){
					var selectObj = document.getElementById('select');
					selPageNum=selectObj.value;
				}
				var text = _vpo.q.toString();
				var pageNum=1;
				if(!paper.title){
					var selectObj = document.getElementById('select');
					pageNum=selectObj.value;
				}else{
					pageNum=paper.title;
				}
				var str={'qString':text,'page':pageNum};
				$.ajax({
					url:context+"/ElsSearchReport",
					method:"post",
//					data:{'qString':text,'categories': JSON.stringify(data),'page':30},
					data:str,
					dataType:'json',
					async:false,
					success:function(data){
						refreshReport(data);
						refresh3(data);
					}
				});
			};
			//20150721 jinxin add
			var paperSearch = function(paper){
				if(!paper.title){
					var selectObj = document.getElementById('select');
					selPageNum=selectObj.value;
				}
				var data=[];
				var text = _vpo.q.toString();
				var pageNum=1;
				if(!paper.title){
					var selectObj = document.getElementById('select');
					pageNum=selectObj.value;
				}else{
					pageNum=paper.title;
				}
				var groups=['Region'];
				data[0]={"Name":groups[0],"Children":childrens};
				var str={'qString':text,'categories': JSON.stringify(data),'page':pageNum};
				$.ajax({
					url:context+"/ElsSearchPage",
					method:"post",
//					data:{'qString':text,'categories': JSON.stringify(data),'page':30},
					data:str,
					dataType:'json',
					async:false,
					success:function(data){
						refresh1(data);
						refresh2(data);
						refresh3(data);
					}
				});
			};
			
			var elscpwsSearch = function(page){
				if(!page.title){
					var selectObj = document.getElementById('select');
					selPageNum=selectObj.value;
				}
				var data=[];
				var text = _vpo.q.toString();
				var pageNum=1;
				if(!page.title){
					var selectObj = document.getElementById('select');
					pageNum=selectObj.value;
				}else{
					pageNum=page.title;
				}
				
				var data=[];
				var index=0;
				$("li[menuChecked='true']").each(function(){
					var _this=this;
					var category=$(_this).closest("ul").attr("category");
					var title=$(_this).find("a").attr("title");
					data[index]={'Name':category,'Children':[{'Name':title}]};
					index++;
				});
				var str={'qString':text,'categories': JSON.stringify(data),'page':pageNum};
				$.ajax({
					url:context+"/ElsSearchCpws",
					method:"post",
//					data:{'qString':text,'categories': JSON.stringify(data),'page':30},
					data:str,
					dataType:'json',
					async:false,
					success:function(data){
						refreshElscpws(data);	//刷新结果内容
						refresh3(data);		//刷新页码栏
						createDiv(data);
					}
				});
			};
			var typicalSearch = function(typical){
				if(!typical.title){
					var selectObj = document.getElementById('select');
					selPageNum=selectObj.value;
				}
				var text = _vpo.q.toString();
				var pageNum=1;
				if(!typical.title){
					var selectObj = document.getElementById('select');
					pageNum=selectObj.value;
				}else{
					pageNum=typical.title;
				}
				$.ajax({
					url:context+"/ElsSearchCase",
					method:"post",
//					data:{'qString':text,'categories': JSON.stringify(data),'page':30},
					data:{'qString':text,'page':pageNum},
					dataType:'json',
					async:false,
					success:function(data){
						refresh4(data);
						refresh3(data);
					}
				});
			};
			var manualSearch = function(manual){
				if(!manual.title){
					var selectObj = document.getElementById('select');
					selPageNum=selectObj.value;
				}
				var text = _vpo.q.toString();
				var pageNum=1;
				if(!manual.title){
					var selectObj = document.getElementById('select');
					pageNum=selectObj.value;
				}else{
					pageNum=manual.title;
				}
				$.ajax({
					url:context+"/ElsSearchManual",
					method:"post",
//					data:{'qString':text,'categories': JSON.stringify(data),'page':30},
					data:{'qString':text,'page':pageNum},
					dataType:'json',
					async:false,
					success:function(data){
						refresh5(data);
						refresh3(data);
					}
				});
			};
			
			var lrSearch = function(lr){
				if(!lr.title){
					var selectObj = document.getElementById('select');
					selPageNum=selectObj.value;
				}
				var text = _vpo.q.toString();
				var pageNum=1;
				if(!lr.title){
					var selectObj = document.getElementById('select');
					pageNum=selectObj.value;
				}else{
					pageNum=lr.title;
				}
				$.ajax({
					url:context+"/ElsSearchLR",
					method:"post",
//					data:{'qString':text,'categories': JSON.stringify(data),'page':30},
					data:{'qString':text,'page':pageNum},
					dataType:'json',
					async:false,
					success:function(data){
						refresh6(data);
						refresh3(data);
					}
				});
			};
			
			var achievementSearch = function(achievement){
				if(!achievement.title){
					var selectObj = document.getElementById('select');
					selPageNum=selectObj.value;
				}
				var data=[];
				var text = _vpo.q.toString();
				var pageNum=1;
				if(!achievement.title){
					var selectObj = document.getElementById('select');
					pageNum=selectObj.value;
				}else{
					pageNum=achievement.title;
				}
				var groups=['Dep'];
				data[0]={"Name":groups[0],"Children":depChildrens};
				var str={'qString':text,'categories': JSON.stringify(data),'page':pageNum};
				$.ajax({
					url:context+"/ElsSearchAchievement",
					method:"post",
//					data:{'qString':text,'categories': JSON.stringify(data),'page':30},
					data:str,
					dataType:'json',
					async:false,
					success:function(data){
						refresh7(data);
						refresh2(data);
						refresh3(data);
					}
				});
			};
			
			var paperSearch = function(paper){//150721 jinxin add
				if(!paper.title){
					var selectObj = document.getElementById('select');
					selPageNum=selectObj.value;
				}
				var data=[];
				var text = _vpo.q.toString();
				var pageNum=1;
				if(!paper.title){
					var selectObj = document.getElementById('select');
					pageNum=selectObj.value;
				}else{
					pageNum=paper.title;
				}
				var groups=['Dep'];
				data[0]={"Name":groups[0],"Children":depChildrens};
				var str={'qString':text,'categories': JSON.stringify(data),'page':pageNum};
				$.ajax({
					url:context+"/ElsSearchPaper",
					method:"post",
//					data:{'qString':text,'categories': JSON.stringify(data),'page':30},
					data:str,
					dataType:'json',
					async:false,
					success:function(data){
						refresh9(data);
						refresh2(data);
						refresh3(data);
					}
				});
			};
			function refreshReport(jsonData){
				var nodes = [];
				var elementList=jsonData.elementList;
				for (var i = 0; i < elementList.length; i++) {
					var result=elementList[i];
					var param = result.param;
					var title = result.title;
					var content=result.content;
					var  href= result.url;
					var q = _vpo.q.toString();
					nodes.push(
							'<dl><dt><a style="cursor:pointer;" target="_blank" class="titl" onclick="openReport(\''+param+'\',\''+href+'\')"><b>' + title + '</b></a>'
							+'</dt>'  
								+ '<dt class="hl">' + content + '</dt></dl>');
				}
				$('.sr-page').html( '<div><div style="margin-top:5px;margin-right:5px;">' + nodes.join("\n") + '</div></div>' );
				
			}
			function refreshElscpws(data){
				var nodes = [];
				var jsonData=data;
				var caseList=data.elementList;
				$('.sr-page').html('');
				for (var i = 0; i < caseList.length; i++) {
					var result=caseList[i];
					var title = result.title;
					var caseId=result.caseId;
					var content=result.content;
					var hasDoc=result.hasDoc;
					//原逻辑
					var _n = _ks['docs'];	//"案件"
					var lk = _n + ':' +  title;	//标题
					//对内容进行高亮
//					var arr_vpoQ = _vpo.q.toString().split(" ");
//					for(var arr_i=0;arr_i<arr_vpoQ.length;arr_i++){
//						content = content.replace(arr_vpoQ[arr_i],'<em>'+arr_vpoQ[arr_i]+'</em>' );
//					}
					var oaOk = isOaOk ? isOaOk() : false;
					if(hasDoc!='true') {
						// TODO
						if (oaOk) { 
							lk ='<b>'+lk+ '</b><a href="nopermissions.jsp?caseId='+caseId+'"" target="_blank" class="lk">案件信息</a>';
							//lk ='<b>'+lk+ '</b>&nbsp;<a href="' + _lk.replace('{0}',caseId)  + '" style="margin-left: 100px;color:#00898a;font-size:15px;text-decoration:none;" target="_blank" class="lk">案件信息</a>'
						}
					} else {
						//_ws是链接地址，将{0}更换为caseid即是有效链接地址
						lk = '<a href="' + _ws.replace('{0}',caseId) + '" target="_blank" class="ws">' + lk + '</a>'; 
						if (oaOk) {
							var videoUrl="http://203.0.71.50:8080/dclocal/zjgySearch?caseId={0}&userId=13001-IBM";
							videoUrl=videoUrl.replace("{0}", caseId);
//							lk += '<a href="nopage.jsp?caseId='+caseId+'" target="_blank" class="lk">庭审视频</a>' ;
							lk += '<a href="'+videoUrl+'" target="_blank" class="lk">庭审视频</a>' ;
							//lk += '<a href="nopermissions.jsp?caseId='+caseId+'" target="_blank" class="lk">案件信息</a>' ;
							lk += '&nbsp;<a href="' + _lk.replace('{0}',caseId)  + '" target="_blank" class="lk">案件信息</a>' ;
						}
					}
					// console.log(ca);
					nodes.push(
						'<dl>' + '<dt>' + lk + ' </dt>'  + '<dd>' + content + '</dd>' + '</dl>'	
					);
					
				}
				$('.sr-page').html( '<div style="position:absolute;right:180px;left:5px;top:2px;">' + nodes.join("\n") + '</div>'+showPageRight(jsonData.totalNum));
			}
			function menuElscpws(data){
				$('.sr>.sr-menu').html('');
				var flnodes = [];
				var jsonData = data;
//				var mb = data.facets.main_briefs;
//				var b = _vpo.b || null;
				$.ajax({url: 'js/app/ayfl.js', dataType: 'json'}).done(function(resp){
						var kbs = [];
						var kbm = {};
						for(var k in resp) {
							try {

								var v = $.trim(resp[k]);//民事、商事。。。
								if(kbs.indexOf(v) < 0) {
									kbs.push(v);
									kbm[v] = [];
								}

								if(kbm[v]) kbm[v].push(k);
							} catch (e) {
								
							}
						}
						var arry = ['刑事','民事','商事','知识产权','海事海商','行政','执行','赔偿','未知'];
						var categoryMap={};
						//案由
						var caseType=jsonData.aggs[0].Children;
						for(var j=0;j<caseType.length;j++){
							var child=caseType[j];
							var name=child.Name;
							var sum=child.Sum;
							var checked=child.Checked;
							var category = $.trim(resp[name]);
							if(categoryMap[category]==null){
								var array=[];
								var cat={'name':name,'sum':sum,'checked':checked};
								array.push(cat);
								categoryMap[category]=array;
							}else{
								var array=categoryMap[category];
								var cat={'name':name,'sum':sum};
								array.push(cat);
								categoryMap[category]=array;
							}
						}
						for(var i in arry) {
//							alert(("key:(" + arry[i] +") <br>value: ("+categoryMap[(arry[i])]+") <br>"));
							var _skey=arry[i];
							var nodes= [];
							var list=categoryMap[arry[i]];
							var booleanBack=false;
							if(list!=null){
								for(var j=0;j<list.length;j++){
									var mynode=list[j];
									if(mynode.checked==true){
										booleanBack=true;
									}
									if(booleanBack){
										nodes.push("<li menuChecked='"+mynode.checked+"'><a href='#' title='"+mynode.name+"' onclick='cpwsAggsSearch(this)'>"+mynode.name+"("+mynode.sum+")"+"</a></li>");
									}else {
										nodes.push("<li menuChecked='"+mynode.checked+"' style='display:none'><a href='#' title='"+mynode.name+"' onclick='cpwsAggsSearch(this)'>"+mynode.name+"("+mynode.sum+")"+"</a></li>");
									}
									
								}
								flnodes.push('<ul class="menuitem" category="category"><span title="' + _skey + '">' + _skey + '<img class="arrow" src="./images/downArrow.png">');
								if(booleanBack){																	
									flnodes.push('<a href="#" style="text-decoration:none;" onclick="cpwsAggsSearch(this)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回上层</a>');
								}
								
								flnodes.push('</span>'+ nodes.join("") + '</ul>');

							}
							
						}
						//年份
						var years=jsonData.aggs[1].Children;
						var yNodes=[];
						var booleanBack=false;
						for(var i=0;i<years.length;i++){
							var year=years[i];
							
							if(year.Checked==true){
								booleanBack=true;
							}
							if(booleanBack){
								yNodes.push("<li menuChecked='"+year.Checked+"'><a href='#' title='"+year.Name+"' onclick='cpwsAggsSearch(this)'>"+year.Name+"("+year.Sum+")"+"</a></li>");
							}else{
								yNodes.push("<li menuChecked='"+year.Checked+"' style='display:none'><a href='#' title='"+year.Name+"' onclick='cpwsAggsSearch(this)'>"+year.Name+"("+year.Sum+")"+"</a></li>");
							}
							
						}
						flnodes.push('<ul class="menuitem" category="year"><span title="年份">年份<img class="arrow" src="./images/downArrow.png">')
						if(booleanBack){																	
							flnodes.push('<a href="#" style="text-decoration:none;" onclick="cpwsAggsSearch(this)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回上层</a>');
						}
						flnodes.push('</span>'+ yNodes.join("") + '</ul>');
						//法院
						var courts=jsonData.aggs[2].Children;
						booleanBack=false;
						var cNodes=[];
						for(var i=0;i<courts.length;i++){
							var court=courts[i];
							
							if(court.Checked==true){
								booleanBack=true;
							}
							if(booleanBack){
								cNodes.push("<li menuChecked='"+court.Checked+"'><a href='#' title='"+court.Name+"' onclick='cpwsAggsSearch(this)'>"+court.Name+"("+court.Sum+")"+"</a></li>");
							}else{
								cNodes.push("<li menuChecked='"+court.Checked+"' style='display:none'><a href='#' title='"+court.Name+"' onclick='cpwsAggsSearch(this)'>"+court.Name+"("+court.Sum+")"+"</a></li>");
							}
						}
						flnodes.push('<ul class="menuitem" category="court"><span title="法院">法院<img class="arrow" src="./images/downArrow.png">')
						if(booleanBack){																	
							flnodes.push('<a href="#" style="text-decoration:none;" onclick="cpwsAggsSearch(this)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回上层</a>');
						}
						flnodes.push('</span>'+ cNodes.join("") + '</ul>');
						
						
						$('.sr-menu').html(  '<div class=\'menuCount\'>共' + jsonData.totalNum + '条记录</div>' + '<div class="scroll menu">' + flnodes.join("\n") + '</div>' );
						
				});
			}
			function refresh1(data){				
				var nodes = [];
				var personList=data.personList;
				$('.sr-page').html('');
				for ( var i = 0; i < personList.length; i++) {
					var result=personList[i];
					var u = getPageUrl({'q': result.Icno,'k':'docs'});
					nodes.push('<div style="margin-top:5px;margin-left:5px;"><dl>'
							+'<dt>'+"姓名："+result.Name);
					var hasAsso='';
					$.ajax({
						url:'population.jsp',
						method:'post',
						data:'icno='+result.Icno,
						dataType:'json',
						async:false,
						success:function(data){
							if(null != data.icno && "" != data.icno && data.icno>0){
								hasAsso ='<a href="'+u+'" class="lk">关联案件（'+data.icno+'）</a>';
							}
						}
					});
					nodes.push(hasAsso);
					nodes.push('</dt>');
					nodes.push('<dd><table width="400px"style="text-align:center"><tr><th>性别</th><th>地区</th><th>身份证</th><th>民族</th></tr>'
							+'<tr><td>'+result.Sex+'</td><td>'+result.Region+'</td>'
							+'<td>'+result.Icno+'</td><td>'+result.Nation+'</td></tr></table></dd>');
					
					nodes.push('</dl></div>');
				}
				$('.sr-page').html( '<div>' + nodes.join("\n") + '</div>' );
			}
			function refresh2(data){
				var onchangeFun = '';
				if(_vpo.k.indexOf('population')>-1){
					onchangeFun = 'aggsSearch(this)';
				}else if(_vpo.k.indexOf('achievement')>-1){
					onchangeFun = 'depSearch(this)';
				}
				var nodes = [];
				var aggs=data.aggs;
				$('.sr>.sr-menu').html('');
				for(var i=0;i<aggs.length;i++){
					var category=aggs[i];
					nodes.push('<ul class="menuitem"><span title="' + category.Name + '">'+category.Name+'<img class="arrow" src="./images/downArrow.png">');
					if(category.Children.length==1){
						nodes.push('<a href="#" style="text-decoration:none;" onclick="'+onchangeFun+'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回上层</a>');
					}nodes.push('</span>');
					for(var j=0;j<category.Children.length;j++){
						var child=category.Children[j];
						var childName=(child.Name==''?'未知':child.Name);
						nodes.push('<li><a href="#" title="' +childName+ '" onclick="'+onchangeFun+'">' +childName+'('+child.Sum+')</a></li>');
					}
				}
				nodes.push('</ul>');
				$('.sr>.sr-menu').html(nodes.join("\n"));
			}
			//页码刷新方法
			function refresh3(data){
				var onchangeFun = '';
				if(_vpo.k.indexOf('typical')>-1){
					onchangeFun = 'typicalSearch(this)';
				}else if(_vpo.k.indexOf('manual')>-1){
					onchangeFun = 'manualSearch(this)';
				}else if(_vpo.k.indexOf('population')>-1){
					onchangeFun = 'pageSearch(this)';
				}else if(_vpo.k.indexOf('lawsRegulations')>-1){
					onchangeFun = 'lrSearch(this)';
				}else if(_vpo.k.indexOf('achievement')>-1){
					onchangeFun = 'achievementSearch(this)';
				}else if(_vpo.k.indexOf('elscpws')>-1){
					onchangeFun = 'elscpwsSearch(this)';
				}else if(_vpo.k.indexOf('paper')>-1){
					onchangeFun = 'paperSearch(this)';
				}else if(_vpo.k.indexOf('report')>-1){
					onchangeFun = 'reportSearch(this)';
				}
				var jsonData = data;
				$('.sr-navi').html('');
				var e = Math.floor(jsonData.totalPage);
				var x = (e > 100) ? 8 : 8;
				var g = Math.ceil( x / 2 );
				var cur = jsonData.currentPage;
				
//				var a = Math.ceil( e / x );
				var b = Math.floor( (cur - 1) / x );
				var s = b * x;
				var y = s + x;
				if( cur > g && e > (x + g) ) {
					s = cur - g;
					y = s + x;
				}
				var nodes = [];
				//nodes.push(showChronological());
				nodes.push('<div class="showPage">');
				var selectnodes = [];
				selectnodes.push('<select id="select" onchange="'+onchangeFun+'">');
				
				for(var d=1;d<=jsonData.totalPage;d++){
					if(d==jsonData.currentPage){
						selectnodes.push('<option value="'+d+'" selected>'+d+'</option>');
					}else{
						selectnodes.push('<option value="'+d+'">'+d+'</option>');
					}
				}
				selectnodes.push('</select>');
				
				nodes.push('显示第'+selectnodes.join("\n")+'页 ');
				if(jsonData.currentPage>1){
					var pageNum = jsonData.currentPage-1;
					nodes.push('<a href=\'#\' title="'+pageNum+'" onclick="'+onchangeFun+'"><span>上一页</span></a>');
				}
				
				for( var c = s; c < y; c++) {
					var p = c + 1;
//					var u = getPageUrl({'p': p});
					if( p > e ) {
						break;
					}
					if( (p % x) == (cur % x)  ) {
						nodes.push('<span>' + p + '</span>');
					} else {
						nodes.push('<a href=\'#\' title="'+p+'" onclick="'+onchangeFun+'"><span>' + p + '</span></a>');
					}
				}
				
				if(jsonData.totalPage != jsonData.currentPage) {
					var pageNum = jsonData.currentPage+1;
					nodes.push('<a href=\'#\' title="'+pageNum+'" onclick="'+onchangeFun+'"><span>下一页</span></a>');
				}
				$('.sr-navi').html(nodes.join("\n") + ' <span>统一检索 为您找到'+jsonData.totalNum+'条记录</span> </div>' );
			}
			function refresh4(data){
				$('.sr-page').html('');
				var nodes = [];
				var caseList=data.caseList;
				for (var i = 0; i < caseList.length; i++) {
					var result=caseList[i];
					var title = result.Title;
					title = title.replace(new RegExp('</b>','gm'),'</em>');
					title = title.replace(new RegExp('<b>','gm'),'<em>');
					var  subContext= result.Context.substring(0,300);
					var q = _vpo.q.toString();
					for(var j=0;j<q.length;j++){
						var newStr='<em>'+q[j]+'</em>';
						var oldStr=q[j];
						subContext = subContext.replace(new RegExp(oldStr,"gm"),newStr);
					}
					nodes.push(
						'<dl>' + '<dt><a href="' + result.Url + '" target="_blank" class="titl"><b>' + title + '</b></a></dt>'  
						+ '<dt class="hl">' + subContext + '</dt>'
						+ '<dt class="caurl">' + result.Url + '</dt>'
						+ '</dl>');
				}
				$('.sr-page').html( '<div>' + nodes.join("\n") + '</div>');
				
			}
			function refresh5(data){
				$('.sr-page').html('');
				var nodes = [];
				var caseList=data.manualList;
				for (var i = 0; i < caseList.length; i++) {
					var result=caseList[i];
					var title = result.Book;
					title = title.replace(new RegExp('</b>','gm'),'</em>');
					title = title.replace(new RegExp('<b>','gm'),'<em>');
					var  fulltext= result.Fulltext.substring(0,250);
					var  chapter= result.Chapter;
					var  piece= result.Piece;
					var q = _vpo.q.toString();
					for(var j=0;j<q.length;j++){
						var newStr='<em>'+q[j]+'</em>';
						var oldStr=q[j];
						fulltext = fulltext.replace(new RegExp(oldStr,"gm"),newStr);
					}
					nodes.push(
						'<dl>' + '<dt><a href="#" target="_blank" class="titl"><b>' + title + '</b></a></dt>'  
						+ '<dt class="hl">' + piece + '</dt>');
					if(chapter!=null){
						nodes.push('<dt class="hl">' + chapter + '</dt>');
					}
					nodes.push('<dt class="hl">' + fulltext + '</dt>'
						+ '</dl>');
				}
				$('.sr-page').html( '<div>' + nodes.join("\n") + '</div>' );
				
			}
			function refresh6(data){
				$('.sr-page').html('');
				var nodes = [];
				var elementList=data.elementList;
				for (var i = 0; i < elementList.length; i++) {
					var result=elementList[i];
					var title = result.Title;
					var  content= result.Content.substring(0,250);
					var  href= result.Href;
					var q = _vpo.q.toString();
					for(var j=0;j<q.length;j++){
						var newStr='<em>'+q[j]+'</em>';
						var oldStr=q[j];
						content = content.replace(new RegExp(oldStr,"gm"),newStr);
					}
					nodes.push(
						'<dl>' + '<dt><a href="'+href+'" target="_blank" class="titl"><b>' + title + '</b></a></dt>'  
						+ '<dt class="hl">' + content + '</dt>'
						+ '<dt class="caurl">' + href + '</dt>'
						+ '</dl>');
				}
				$('.sr-page').html( '<div>' + nodes.join("\n") + '</div>' );
			}
			function refresh7(data){
				//alert(_vpo.k);
				if(_vpo.k.indexOf('card')>-1){
					refresh8(data);
					return;
				}

				var tbodytr="";
//				var nodes = [];
				var jsonData =  data ;
				var elementList=jsonData.elementList;
				
				var table1="<table width='100%'><tr height='50px'>"
					+"<td style='width:18%;font-size: 14px;text-align: center'>档案业绩统一检索</td>"
					+"<td style='width:10%;font-size: 14px;text-align: center'><a href='./?q="+_vpo.q+"&k=achievement'>列表显示</a></td>"
					+"<td style='width:13%;font-size: 14px;text-align: center'><a href='./?q="+_vpo.q+"&k=achievementcard'>详细信息显示</a></td>"
					+"<td></td>"
					+"<td style='width:40%;font-size: 14px;text-align: right;display:none;'>"
						+"<button style='margin-right: 1%;border-color: #D6D6D4;border-width: 1px;color: #00A48B;background-color: #ffffff;border-radius: 5px;height: 22px;width: 80px;'>按收案数</button>"
						+"<button style='margin-right: 1%;border-color: #D6D6D4;border-width: 1px;color: #00A48B;background-color: #ffffff;border-radius: 5px;height: 22px;width: 80px;'>按结案数</button>"
						+"<button style='margin-right: 1%;border-color: #D6D6D4;border-width: 1px;color: #00A48B;background-color: #ffffff;border-radius: 5px;height: 22px;width: 90px;'>按未结案数</button>"
					+"</td><td style='width:13%;font-size: 14px;text-align: letf;display:none;'>"
						+"<select style='margin-left: 1%;width:80px;height:20px;'><option value='1' selected=''>按年份</option></select>"
					+"</td>"
					+"</tr></table>";
				
				
				for (var i = 0; i < elementList.length; i++) {
					var result=elementList[i];
					var tdId='unfoldTR'+i;
					var occlevel = result.Occlevel;
					tbodytr+='<tr onclick="unfold(\''+tdId+'\');">'
						+'<td>'+result.Name+'</td>'
						+'<td>'+result.Court+'</td>'
						+'<td>'+result.Dep+'</td>'
						+'<td>'+result.Proftitle+'</td>'
						+'<td>'+result.Degree+'</td>'
						+'<td>'+result.Polstatus+'</td>'
						+'<td>'+occlevel+'</td>'
						+'<td>'+result.Job+'</td>'
						+'<td>'+result.Jobsituation+'</td>'
						+'<td>'+result.Jobtype+'</td>'
						+'<td>'+result.Birth+'</td>'
						+'</tr>';
					tbodytr+='<tr style="display: none;background-color: #F2FBFA;" id="'+tdId+'" class="unfoldTR">'
						+'<td colspan=2><img class="lHead" src="./picture/'+result.Code+'.jpg"/></td>'
						+'<td colspan=9><ul style="float: left;margin-right: 1%"><li><img src="./images/jnsa.png"/></li><li><span>'+result.Casenum+'</span></li></ul>'
						+'<ul style="float: left;margin-right: 1%"><li><img src="./images/jnja.png"/></li><li><span>'+result.Endcase+'</span></li></ul>'
						+'<ul style="float: left;margin-right: 1%"><li><img src="./images/jnwj.png"/></li><li><span>'+result.Incase+'</span></li></ul>'
						+'<ul style="float: left;margin-right: 1%"><li><img src="./images/zbas.png"/></li><li><span>'+result.Casetotal+'</span></li></ul></td>'
						+'</tr>';
				}
				var table2="<table id='unfoldtable' width='100%' style='border: 10px solid #ffffff;  border-spacing:0px;'><tr>"
					+"<th>姓名</th><th>所在法院</th><th>工作部门</th><th>审判职称</th><th>学历学位</th><th>政治面貌</th><th>职级</th><th>行政职务</th><th>在职情况</th><th>职务类别</th><th>出生年月</th>"
					+"</tr>"
					+tbodytr
					+"</table>";
				$('.sr-page').html( '<div class="yjda1" style="height:50px;">' + table1 + '</div><div class="yjda2">' + table2 + '</div>');
				
			}
			function refresh8(data){

//				var tbodytr="";
//				var nodes = [];
				var jsonData =  data ;
				var elementList=jsonData.elementList;
				
				var table1="<table width='100%'><tr height='50px'>"
					+"<td style='width:18%;font-size: 14px;text-align: center'>档案业绩统一检索</td>"
					+"<td style='width:10%;font-size: 14px;text-align: center'><a href='./?q="+_vpo.q+"&k=achievement'>列表显示</a></td>"
					+"<td style='width:13%;font-size: 14px;text-align: center'><a href='./?q="+_vpo.q+"&k=achievementcard'>详细信息显示</a></td>"
					+"<td></td>"
					+"<td style='width:40%;font-size: 14px;text-align: right;display:none'>"
						+"<button style='margin-right: 1%;border-color: #D6D6D4;border-width: 1px;color: #00A48B;background-color: #ffffff;border-radius: 5px;height: 22px;width: 80px;'>按收案数</button>"
						+"<button style='margin-right: 1%;border-color: #D6D6D4;border-width: 1px;color: #00A48B;background-color: #ffffff;border-radius: 5px;height: 22px;width: 80px;'>按结案数</button>"
						+"<button style='margin-right: 1%;border-color: #D6D6D4;border-width: 1px;color: #00A48B;background-color: #ffffff;border-radius: 5px;height: 22px;width: 90px;'>按未结案数</button>"
					+"</td><td style='width:13%;font-size: 14px;text-align: letf;display:none'>"
						+"<select style='margin-left: 1%;width:80px;height:20px;'><option value='1' selected=''>按年份</option></select>"
					+"</td>"
					+"</tr></table>";
				
					var divList="";
					for (var i = 0; i < elementList.length; i++) {
						if(i>=3){
							break;
						}
						var result=elementList[i];
//						var tdId='unfoldTR'+i;
						var occlevel = result.Occlevel;
						divList+='<div style="height:520px;width:31.7%;float: left;border: 1px solid #EEEEEC;margin: 15px 0 10px 1%;">'
//							+'<ul style="width: 92%;"><li style="text-align: center;padding: 12px;border-bottom: 1px solid #dddddd;"><img src="./images/touxiangbak.jpg"/><br/>'+result.Name+'</li>'
							+'<ul style="width: 92%;"><li style="text-align: center;padding: 12px;border-bottom: 1px solid #dddddd;"><img class="head" src="./picture/'+result.Code+'.jpg"/><br/>'+result.Name+'</li>'
//							+'<li><input type="submit" value="加入收藏" class="scbutton"></li>'
							+'<li style="margin-top:20px;"><span class="title">所在法院 :</span> '+result.Court+'</li>'
							+'<li><span class="title">工作部门 :</span> '+result.Dep+'</li>'
							+'<li><span class="title">审判职称 :</span> '+result.Proftitle+'</li>'
							+'<li><span class="title">学历学位 :</span> '+result.Degree+'</li>'
							+'<li><span class="title">政治面貌 :</span> '+result.Polstatus+'</li>'
							+'<li><span class="title">职级 :</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '+occlevel+'</li>'
							+'<li><span class="title">行政职务 :</span> '+result.Job+'</li>'
							+'<li><span class="title">在职情况 :</span> '+result.Jobsituation+'</li>'
							+'<li><span class="title">职务类别 :</span> '+result.Jobtype+'</li>'
							+'<li style="border-bottom: 1px solid #dddddd;"><span class="title">出生年月 :</span> '+result.Birth+'</li>'
							+'<li>'
							+'<ul><li><ul style="float: left;text-align: center;width: 25%;"><li><img src="./images/jnsas.png"/></li><li><span>'+result.Casenum+'</span></li></ul>'
							+'<ul style="float: left;text-align: center;width: 25%;"><li><img src="./images/jnjas.png"/></li><li><span>'+result.Endcase+'</span></li></ul>'
							+'<ul style="float: left;text-align: center;width: 25%;"><li><img src="./images/jnwjs.png"/></li><li><span>'+result.Incase+'</span></li></ul>'
							+'<ul style="float: left;text-align: center;width: 25%;"><li><img src="./images/zbass.png"/></li><li><span>'+result.Casetotal+'</span></li></ul></li>'
							+'</div>';
					}
					
					var yjdacover='<div class="yjdacover" style="left: 10px;background-image:url(./images/left.png);" onmousemove="showCover()" onmouseout="hideCover()" title="'+(jsonData.currentPage-1)+'" onclick="achievementSearch(this)"></div><div class="yjdacover" style="right:1.5%;background-image:url(./images/right.png);"  onmousemove="showCover()" onmouseout="hideCover()" title='+(jsonData.currentPage+1)+' onclick="achievementSearch(this)"></div>';
					$('.sr-page').html( '<div class="yjda1" style="height:50px;">' + table1 + '</div><div class="yjda2">' + divList + '</div>'+yjdacover);
				
			}
			
			function refresh9(data){//150721 jinxin add
				
				
				$('.sr-page').html('');
				var nodes = [];
				//var jsonData = eval("(" + data + ")");
				//alert(jsonData);
				var elementList=data.elementList;
				//alert(elementList);
				for (var i = 0; i < elementList.length; i++) {
					
					var result=elementList[i];
					var title = result.title;
					var  content;
					if(result.content.length>250){
						content= result.content.substring(0,250);
					}else{
						content= result.content;
					}
					
					var  href= "ElsSearchPaperDetail?id="+result.id;
					var q = _vpo.q.toString();
					for(var j=0;j<q.length;j++){
						var newStr='<em>'+q[j]+'</em>';
						var oldStr=q[j];
						content = content.replace(new RegExp(oldStr,"gm"),newStr);
					}
					nodes.push(
							'<dl><dt><a style="cursor:pointer;" onclick="detail('+result.id+');" target="_blank" class="titl"><b>' + title + '</b></a></dt>'  
								+ '<dt class="hl">' + content + '</dt></dl>');
				}
				//alert(nodes);
				$('.sr-page').html( '<div><div style="margin-top:5px;margin-right:5px;">' + nodes.join("\n") + '</div></div>' );
				
				
				
				
				
			}
			
			function showCover(){
				//alert(1);
				$(".yjdacover").css("opacity","0.5").css("filter","alpha(opacity=50)");	
			}
			function hideCover(){
				$(".yjdacover").css("opacity","0").css("filter","alpha(opacity=0)");	
			}
			
			var menu = function(data) {
				if(null != _vpo.k && _vpo.k.indexOf('population') >-1){
					var nodes = [];
//					nodes.push('<div class="sr-menu"><div class="scroll menu">');
					var jsonData = eval("(" + data + ")");
					var aggs=jsonData.aggs;
					for(var i=0;i<aggs.length;i++){
						var category=aggs[i];
						nodes.push('<ul class="menuitem"><span title="' + category.Name + '">'+category.Name+' <img class="arrow" src="./images/downArrow.png"></span>');
						for(var j=0;j<category.Children.length;j++){
							var child=category.Children[j];
							var childName=(child.Name==''?'未知':child.Name);
							nodes.push('<li><a href="#" title="' +childName+ '" onclick="aggsSearch(this)">' +childName+'('+child.Sum+')</a></li>');
						}
					}
					nodes.push('</ul>');
					$('.sr-menu').html(nodes.join("\n"));
					
				}else if(null != _vpo.k && _vpo.k.indexOf('achievement') >-1){
					var nodes = [];
//					nodes.push('<div class="sr-menu"><div class="scroll menu">');
					var jsonData = eval("(" + data + ")");
					var aggs=jsonData.aggs;
					for(var i=0;i<aggs.length;i++){
						var category=aggs[i];
						nodes.push('<ul class="menuitem"><span title="' + category.Name + '">'+category.Name+'<img class="arrow" src="./images/downArrow.png"></span>');
						for(var j=0;j<category.Children.length;j++){
							var child=category.Children[j];
							var childName=(child.Name==''?'未知':child.Name);
							nodes.push('<li><a href="#" title="' +childName+ '" onclick="depSearch(this)">' +childName+'('+child.Sum+')</a></li>');
						}
					}
					nodes.push('</ul>');
					$('.sr-menu').html(nodes.join("\n"));
					
				}else if(null != _vpo.k && _vpo.k.indexOf('elscpws') >-1){
					var jsonData = eval("(" + data + ")");
					menuElscpws(jsonData);
				}else {
					var flnodes = [];
					var mb = data.facets.main_briefs;
					var b = _vpo.b || null;
					// $.ajax({url: 'briefs.jsp', dataType:
					// 'json'}).done(function(resp){
					$.ajax({url: 'js/app/ayfl.js', dataType: 'json'}).done(function(resp){
//						$.ajax({url: 'js/app/ajfl.js', dataType: 'json'}).done(function(respFl){

							var kbs = [];
							var kbm = {};
//							var fls = {};
							// var n = 0;
//							var aaa = 0;
							for(var k in resp) {
								// alert(k);
								// if(aaa > 5) break;
								try {

									var v = $.trim(resp[k]);//民事、商事。。。
//									var vlx = $.trim(respFl[v]);
									if(kbs.indexOf(v) < 0) {
										kbs.push(v);
										kbm[v] = [];
									}

//									if(fls[vlx]==null){
//										fls[vlx] = [];
//									}

									if(kbm[v]) kbm[v].push(k);
//									if(fls[vlx] && fls[vlx].indexOf(v)<0) fls[vlx].push(v);
								} catch (e) {
									
								}
//								aaa++;
								// n++;
							}
							// alert(kbs);
							// alert(kbm);
							// _mnl = 3;
							var arry = ['刑事','民事','商事','知识产权','海事海商','行政','执行','赔偿','未知'];
							for(var i=0;i<arry.length;i++){
							//遍历大类
								var key =arry[i];
								var nodes = [];
								var abc =kbm[key];	//ajfl列表
//								if(abc.length>0){
								var snodes = [];
//								for(var x = 0; x < abc.length; x++) {
//									var kb = abc[x];		//ajfl中一个brief的明细列
//									var ks = kbm[kb];		//briefs的大类
									
									if(null != abc){
										for(var j = 0; j < abc.length; j++) {
											var k = abc[j];	//ayfl中的一个brief的各个明细
											var v = mb[k];	//数量
											var _ssk = !!k ? k : '';
												_ssk = ( (_ssk && _ssk.length > _mnl) ? (_ssk.substring(0, _mnl) + '..') : _ssk );
											var u = getPageUrl({'b': k, 'p' : 1});
											
											if(null == b && v > 0) {
												snodes.push(
//														'<li><a href="' + u + '" title="' + k + '">' + _ssk + '(' + v + ')</a></li>'
														u+","+k+","+_ssk+","+v
												);
											} else if (null != b && v > 0 && b == k) {
												snodes.push(
//														'<li><a href="' + u + '" title="' + k + '">' + _ssk + '(' + v + ')</a></li>'
														u+","+k+","+_ssk+","+v
												);
											}
										}
										
										var _skb = !!k ? k : '';
										_skb = ( (_skb && _skb.length > (_mnl + 2)) ? (_skb.substring(0, (_mnl + 2)) + '..') : _skb );
										//if(snodes.length > 0) {
										//	nodes.push(snodes.join(""))
										//}
									}
									
//								}
								
								var sortNumber=function(a, b)
								{
									return b.split(",")[3] - a.split(",")[3];
								};
								var sortSnodes=snodes.sort(sortNumber);
								var linodes=[];
								for(var index=0;index<sortSnodes.length;index++){
									var lis=sortSnodes[index];
									var li=lis.split(",");
									linodes.push(
											'<li><a href="' + li[0] + '" title="' + li[1] + '">' + li[2] + '(' + li[3] + ')</a></li>'
									);
								}
								if(linodes.length > 0) {
									nodes.push(linodes.join(""));
								}
								var _skey = !!key ? key : '';	//大类名称
								_skey = ( (_skey && _skey.length > (_mnl + 2)) ? (_skey.substring(0, (_mnl + 2)) + '..') : _skey );
								if(nodes.length > 0) {
									flnodes.push('<ul class="menuitem"><span title="' + _skey + '">' + _skey + '<img class="arrow" src="./images/downArrow.png"></span>'+ nodes.join("") + '</ul>');
								}
							}
							// alert( '<h3>共' + data['total-docs'] + '条记录</h3>' + '<div
							// class="scroll menu">' + nodes.join("\n") + '</div>' );
							$('.sr-menu').html(  '<div class=\'menuCount\'>共' + data['total-docs'] + '条记录</div>' + '<div class="scroll menu">' + flnodes.join("\n") + '</div>' );
						
//						});
					});
				}
			};
			
			
			if(_vpo.k && _vpo.k.indexOf('population') >-1){
				var text = _vpo.q.toString();
				$.ajax({
					url:context+"/ElsSearchAggs",
					method:"post",
					data:{'qString':text},
					success:function(resp){
						if(!resp && !resp.facets) return;
						var data = resp;
						// 抱歉，没有找到与“简单”相关的结果!
						if(data && (eval("(" + data + ")").totalPage)!=0) {
							$('body').addClass('po');
							menu(data);
							
							page(data);
							navi(data);
							if(!_vpo.v || _vpo.b) {
								var left = ( $('.sb input[name=q]').offset().left + $('.nav').width() + $('.sb .submit').width() + $('.sb .more').width() + 18 - 180 );
								$('.nav').css( { 'left': (0 - left) } );
							}
						} else {
							$('body').addClass('em');
							$('.sr-page').html('<h2>' + '抱歉，没有找到与“<em>' + _vpo['q'] + '</em>”相关的结果!' + '</h2>');
						}

						// alert($('.sr-').text());
						// alert($('.sr-menu').html());

						var u = getPageUrl({'v': 't', 'b' : ''});
						$('.sb .more').attr('href', u).show();
					}
				});
			}else if(_vpo.k && _vpo.k.indexOf('typical') >-1){
				var text = _vpo.q.toString();
				$.ajax({
					url:context+"/ElsSearchCase",
					method:"post",
					data:{'qString':text},
					success:function(resp){
						if(!resp && !resp.facets) return;
						var data = resp;
						// 抱歉，没有找到与“简单”相关的结果!
						if(data && (eval("(" + data + ")").totalPage)!=0) {
							$('body').addClass('ty');
							
							page(data);
							navi(data);
							if(!_vpo.v || _vpo.b) {
								var left = ( $('.sb input[name=q]').offset().left + $('.nav').width() + $('.sb .submit').width() + $('.sb .more').width() + 18 - 180 );
								$('.nav').css( { 'left': (0 - left) } );
							} else {
								
							}
						} else {
							$('body').addClass('em');
							$('.sr-page').html('<h2>' + '抱歉，没有找到与“<em>' + _vpo['q'] + '</em>”相关的结果!' + '</h2>');
						}

						// alert($('.sr-').text());
						// alert($('.sr-menu').html());

						var u = getPageUrl({'v': 't', 'b' : ''});
						$('.sb .more').attr('href', u).show();
					}
				});
			}else if(_vpo.k && _vpo.k.indexOf('manual') >-1){
				var text = _vpo.q.toString();
				$.ajax({
					url:context+"/ElsSearchManual",
					method:"post",
					data:{'qString':text},
					success:function(resp){
						if(!resp && !resp.facets) return;
						var data = resp;
						// 抱歉，没有找到与“简单”相关的结果!
						if(data && (eval("(" + data + ")").totalPage)!=0) {
							$('body').addClass('ma');
							
							page(data);
							navi(data);
							if(!_vpo.v || _vpo.b) {
								var left = ( $('.sb input[name=q]').offset().left + $('.nav').width() + $('.sb .submit').width() + $('.sb .more').width() + 18 - 180 );
								$('.nav').css( { 'left': (0 - left) } );
							} else {
								
							}
						} else {
							$('body').addClass('em');
							$('.sr-page').html('<h2>' + '抱歉，没有找到与“<em>' + _vpo['q'] + '</em>”相关的结果!' + '</h2>');
						}

						// alert($('.sr-').text());
						// alert($('.sr-menu').html());

						var u = getPageUrl({'v': 't', 'b' : ''});
						$('.sb .more').attr('href', u).show();
					}
				});
			}else if(_vpo.k && _vpo.k.indexOf('lawsRegulations') >-1){
				var text = _vpo.q.toString();
				$.ajax({
					url:context+"/ElsSearchLR",
					method:"post",
					data:{'qString':text},
					success:function(resp){
						if(!resp && !resp.facets) return;
						var data = resp;
						// 抱歉，没有找到与“简单”相关的结果!
						if(data && (eval("(" + data + ")").totalPage)!=0) {
							$('body').addClass('lr');
							
							page(data);
							navi(data);
							if(!_vpo.v || _vpo.b) {
								var left = ( $('.sb input[name=q]').offset().left + $('.nav').width() + $('.sb .submit').width() + $('.sb .more').width() + 18 - 180 );
								$('.nav').css( { 'left': (0 - left) } );
							} else {
								
							}
						} else {
							$('body').addClass('em');
							$('.sr-page').html('<h2>' + '抱歉，没有找到与“<em>' + _vpo['q'] + '</em>”相关的结果!' + '</h2>');
						}

						// alert($('.sr-').text());
						// alert($('.sr-menu').html());

						var u = getPageUrl({'v': 't', 'b' : ''});
						$('.sb .more').attr('href', u).show();
					}
				});
			}else if(_vpo.k && _vpo.k.indexOf('achievement') >-1){
				var text = _vpo.q.toString();
				$.ajax({
					url:context+"/ElsSearchAchievement",
					method:"post",
					data:{'qString':text},
					success:function(resp){
						if(!resp && !resp.facets) return;
						var data = resp;
						// 抱歉，没有找到与“简单”相关的结果!
						if(data && (eval("(" + data + ")").totalPage)!=0) {
							$('body').addClass('ac');
							menu(data);
							
							page(data);
							navi(data);
							if(!_vpo.v || _vpo.b) {
								var left = ( $('.sb input[name=q]').offset().left + $('.nav').width() + $('.sb .submit').width() + $('.sb .more').width() + 18 - 180 );
								$('.nav').css( { 'left': (0 - left) } );
							}
						} else {
							$('body').addClass('em');
							$('.sr-page').html('<h2>' + '抱歉，没有找到与“<em>' + _vpo['q'] + '</em>”相关的结果!' + '</h2>');
						}

						// alert($('.sr-').text());
						// alert($('.sr-menu').html());

						var u = getPageUrl({'v': 't', 'b' : ''});
						$('.sb .more').attr('href', u).show();
					}
				});
			}else if(_vpo.k && _vpo.k.indexOf('elscpws') >-1){
			//ELS裁判文书
				var text = _vpo.q.toString();
				$.ajax({
					url:context+"/ElsSearchCpws",
					method:"post",
					data:{'qString':text},
					success:function(resp){
						if(!resp && !resp.facets) return;
						var data = resp;
						// 抱歉，没有找到与“简单”相关的结果!
						if(data && (eval("(" + data + ")").totalPage)!=0) {
							$('body').addClass('cpws');
							menu(data);
							page(data);
							navi(data);
							if(!_vpo.v || _vpo.b) {
								var left = ( $('.sb input[name=q]').offset().left + $('.nav').width() + $('.sb .submit').width() + $('.sb .more').width() + 18 - 180 );
								$('.nav').css( { 'left': (0 - left) } );
							}
						} else {
							$('body').addClass('em');
							$('.sr-page').html('<h2>' + '抱歉，没有找到与“<em>' + _vpo['q'] + '</em>”相关的结果!' + '</h2>');
						}
						var u = getPageUrl({'v': 't', 'b' : ''});
						$('.sb .more').attr('href', u).show();
					}
				});
			}else if(_vpo.k && _vpo.k.indexOf('paper') >-1){//150721 jinxin add
				var text = _vpo.q.toString();
				$.ajax({
					url:context+"/ElsSearchPaper",
					method:"post",
					data:{'qString':text},
					success:function(resp){
						if(!resp && !resp.facets) return;
						var data = resp;
						// 抱歉，没有找到与“简单”相关的结果!
						if(data && (eval("(" + data + ")").totalPage)!=0) {
							$('body').addClass('pap');
							//menu(data);
							
							page(data);
							navi(data);
							if(!_vpo.v || _vpo.b) {
								var left = ( $('.sb input[name=q]').offset().left + $('.nav').width() + $('.sb .submit').width() + $('.sb .more').width() + 18 - 180 );
								$('.nav').css( { 'left': (0 - left) } );
							}
						} else {
							$('body').addClass('em');
							$('.sr-page').html('<h2>' + '抱歉，没有找到与“<em>' + _vpo['q'] + '</em>”相关的结果!' + '</h2>');
						}

						// alert($('.sr-').text());
						// alert($('.sr-menu').html());

						var u = getPageUrl({'v': 't', 'b' : ''});
						$('.sb .more').attr('href', u).show();
						$(".docs").find("a").css({"border-bottom":"0px","font-weight":"normal"});

					}
				});
			}else if(_vpo.k && _vpo.k.indexOf('alipay') >-1){
				var text = _vpo.q.toString();
				$.ajax({
					url:context+"/SearchAliPay",
					method:"post",
					data:{'qString':text},
					success:function(resp){
						if(!resp && !resp.facets) return;
						var data = resp;
						// 抱歉，没有找到与“简单”相关的结果!
						if(data && (eval("(" + data + ")").totalPage)!=0) {
							$('body').addClass('alipay');
							//menu(data);
							
							page(data);
//							navi(data);
							if(!_vpo.v || _vpo.b) {
								var left = ( $('.sb input[name=q]').offset().left + $('.nav').width() + $('.sb .submit').width() + $('.sb .more').width() + 18 - 180 );
								$('.nav').css( { 'left': (0 - left) } );
							}
						} else {
							$('body').addClass('em');
							$('.sr-page').html('<h2>' + '抱歉，没有找到与“<em>' + _vpo['q'] + '</em>”相关的结果!' + '</h2>');
						}

						// alert($('.sr-').text());
						// alert($('.sr-menu').html());

						var u = getPageUrl({'v': 't', 'b' : ''});
						$('.sb .more').attr('href', u).show();
						$(".docs").find("a").css({"border-bottom":"0px","font-weight":"normal"});

					}
				});
			}else if(_vpo.k && _vpo.k.indexOf('report') >-1){
				var text = _vpo.q.toString();
				$.ajax({
					url:context+"/ElsSearchReport",
					method:"post",
					data:{'qString':text},
					success:function(resp){
						if(!resp && !resp.facets) return;
						var data = resp;
						// 抱歉，没有找到与“简单”相关的结果!
						if(data && (eval("(" + data + ")").totalPage)!=0) {
							$('body').addClass('report');
							page(data);
							navi(data);
							if(!_vpo.v || _vpo.b) {
								var left = ( $('.sb input[name=q]').offset().left + $('.nav').width() + $('.sb .submit').width() + $('.sb .more').width() + 18 - 180 );
								$('.nav').css( { 'left': (0 - left) } );
							}
						} else {
							$('body').addClass('em');
							$('.sr-page').html('<h2>' + '抱歉，没有找到与“<em>' + _vpo['q'] + '</em>”相关的结果!' + '</h2>');
						}

						// alert($('.sr-').text());
						// alert($('.sr-menu').html());

						var u = getPageUrl({'v': 't', 'b' : ''});
						$('.sb .more').attr('href', u).show();
						$(".docs").find("a").css({"border-bottom":"0px","font-weight":"normal"});

					}
				});
			}else{
				$.ajax({ 
					url: _se,
					type: "POST",
					dataType: "json", // 表示返回值类型，不必须
					// data: JSON.stringify(_vpo),
					data: _vpo
				}).done(function(resp) {
					if(!resp && !resp.facets) return;
					var data = resp;
					// 抱歉，没有找到与“简单”相关的结果!
					if((data && data['total-docs'])) {
						$('body').removeClass('em');
						if(_vpo.k && _vpo.k.indexOf('pages') == 0) {
							$('body').addClass('pg');
							// no menu
						}else {
							$('body').removeClass('pg');
							menu(data);
						}
						page(data);
						navi(data);
						if(!_vpo.v || _vpo.b) {
							var left = ( $('.sb input[name=q]').offset().left + $('.nav').width() + $('.sb .submit').width() + $('.sb .more').width() + 18 - 180 );
							$('.nav').css( { 'left': (0 - left) } );
						} else {
							
						}
					} else {
						$('body').addClass('em');
						$('.sr-page').html('<h2>' + '抱歉，没有找到与“<em>' + _vpo['q'] + '</em>”相关的结果!' + '</h2>');
					}

					// alert($('.sr-').text());
					// alert($('.sr-menu').html());

					var u = getPageUrl({'v': 't', 'b' : ''});
					$('.sb .more').attr('href', u).show();
	       		});
			}
			
		//}
			
	// no _vpo or no q
	} else { 
			$('body').addClass('nm');
	}

	var autoSize = function(){
			var _h = $(window).height();
			//var _w = $(window).width();
			// $('.rs .sb').height(120);
			var _sbh = 110;
			var _fth = 30;
			var _nvh = 40;
			//var menu_w = $(".sr-menu").width();
			$('.rs .sr').height(_h - _fth - _sbh);
			$('.rs .ft').height(_fth);
			$('.rs .sr-page').height(_h - _fth - _sbh - _nvh);
			//$('.rs .sr-menu').height(_h - _fth - _sbh - 10);
			$('.rs .sr-menu').height(_h  - _sbh );
			$('.rs .sr-navi').height(_nvh);
			$('.rs .aaaaa').height(_h - _fth - _sbh - _nvh);
			// alert($('.rs .sr-page').height());
			// alert($('.rs .sr-menu').height());
			//$('.rs .sr-page>div').eq(0).width(_w - menu_w - 180);
		};


	if( $('body').hasClass('nm') ) {
	//		$('.nm .sb .text').click(autoZoom)
	}

	$(window).bind("load resize", autoSize);
	(autoSize)();
	
	var _sub = $('.sb .submit');
	var _nq = $('.sb input[name=q]');

	if(_vpo && _vpo.q) _nq.val(_vpo.q);

	$('.sb .en li a').each(function() {
		var _k = $(this).parent().attr('class');
		var _u = getPageUrl({'k': _k, 'p': ''});
		$(this).attr('href', _u);
	});

	function showPageRight(totalnum){
		var str='<div class="pageRight">'
		//+'<div class="accurateQuery"><img src=""><a href="#" class="accurateQueryLink">精确查询</a></div>'
		+'<div class="recordNumShow">'
		+'<span style="line-height: 2em;"><img src="./images/record_icon.png" class="record">统一检索</span><br/><br/>'
		+'<span style="margin-left: 45px;font-size: 40px;">'+ totalnum +'</span><br/>'
		+'<span style="margin-left: 50px;">条记录</span></div>'
		+'</div>';
		return str;
	}
	function showChronological(){
		var str='<div class="Chronological"><a href="#">按时间排序</a></div>';
		return str;
	};


	function createDiv(data){
//		alert(data.length);
		$("div.pageRight").css("height","451px").css("background","white").css("border-width","1px").css("border-style","solid").css("border-color","#D7D6D1");
		$("div.pageRight div.recordNumShow").css("border","none");
		$("div.pageRight div.recordNumShow").css("height","160px");
		$("div.pageRight div.recordNumShow")
		.after("<div style='width:180px;'>" +
				"<a style='position: absolute;left: 15px;cursor:pointer;' onclick='initData(0,"+data+")'>案件</a>" +
				"<a style='position: absolute;right: 75px;cursor:pointer; onclick='initData(1,"+data+")'>年份</a>" +
				"<a style='position: absolute;right: 15px;cursor:pointer; onclick='initData(2,"+data+")'>法院</a>" +
				"</div></br>" +
				"<div id='pie' style='height:180px;'></div>"); 
		require.config({
			paths:{
				echarts:context+'/js'
			}
		});	
		
		initData(0,data);
	}
	
	function initData(type,data){
		
		var data = new Array();
		var v = data.aggs[0].Children;
		if(type==0){
			var j = 0;
			var value = 0;
			for(var i=0;i<v.length;i++){
				if(v[i].Sum<5){
					value += v[i].Sum;
				}else{
					data[j] = { name: v[i].Name, value: v[i].Sum};
					j++;
				}
			}
			data[data.length] = { name: "其他", value: value};
			createPie(data);
		}else if(type==1){
			for(var i=0;i<v.length;i++){
				data[i] = { name: v[i].Name, value: v[i].Sum};
			}
			createPie(data);
		}else if(type==2){
			for(var i=0;i<v.length;i++){
				data[i] = { name: v[i].Name, value: v[i].Sum};
			}
			createPie(data);
		}
		
	}
	
	
	/*创建饼图-案件比例图  1047 menuElscpws*/
	function createPie(data){
		var text = '';
//		var v = data.aggs[type].Children;
//		$("div.pageRight").css("height","451px").css("background","white").css("border-width","1px").css("border-style","solid").css("border-color","#D7D6D1");
//		$("div.pageRight div.recordNumShow").css("border","none");
//		$("div.pageRight div.recordNumShow").css("height","160px");
//		$("div.pageRight div.recordNumShow")
//		.after("<div style='width:180px;'>" +
//				"<a style='position: absolute;left: 15px;' onclick='createPie(0,"+data+")'>案件</a>" +
//				"<a style='position: absolute;right: 75px;' onclick='createPie(1,"+data+")'>年份</a>" +
//				"<a style='position: absolute;right: 15px;' onclick='createPie(2,"+data+")'>法院</a>" +
//				"</div></br>" +
//				"<div id='pie' style='height:180px;'></div>");            
		//var text = "案件比例图";
//		var data = new Array();
//		var j = 0;
//		var value = 0;
//		for(var i=0;i<v.length;i++){
//			if(v[i].Sum<5){
//				value += v[i].Sum;
//			}else{
//				data[j] = { name: v[i].Name, value: v[i].Sum};
//				j++;
//			}
//		}
//		data[data.length] = { name: "其他", value: value};
//		$(".sr-page .pageRight").
		
	     require(
	 	        [
	 	            'echarts',
	 	        'echarts/chart/funnel',   // 按需加载所需图表，如需动态类型切换功能，别忘了同时加载相应图表
	 	        'echarts/chart/pie',
	 	        'echarts/chart/line'
	 	    ],
	 	    function (ec) {
	 	        var myChart = ec.init(document.getElementById('pie'));
	 	      var  option = {
	 						    title : {						//标题
	 						        text: text,    //主标题文本，'\n'指定换行
//	 						        subtext: '与'+text+'相关证据比例图',        //副标题文本，'\n'指定换行
	 						       textStyle: {
	 						    	  fontSize: 12
	 						    	  },
	 						        x:'right',                //水平安放位置，默认为左侧，可选为：'center' | 'left' | 'right' | {number}（x坐标，单位px）
	 								y:'bottom'
	 						    },
	 						    tooltip : {	//提示框，鼠标悬浮交互时的信息提示
	 						    	show:true,		//显示策略，可选为：true（显示） | false（隐藏）
	 						        showContent:true,
	 						        trigger: 'item',	//触发类型，默认数据触发，见下图，可选为：'item' | 'axis'
	 						        formatter: "{a} <br/>{b} : {c} ({d}%)",
	 						        padding: 2,
	 						        textStyle: {
	 						    	  fontSize: 10,
	 						    	  }
//	 						        z: 8,
//	 						        position: [300,-180]
	 						    },
	 						/*    
	 						    legend: {		//图例，每个图表最多仅有一个图例，混搭图表共享
	 						    	show:true,
	 						        orient : 'vertical',  //布局方式，默认为水平布局，可选为：'horizontal' | 'vertical'
	 						        x : 'left',		//水平安放位置，默认为全图居中，可选为：'center' | 'left' | 'right' | {number}（x坐标，单位px）
	 						        y :	 'top',		//垂直安放位置，默认为全图顶端，可选为：'top' | 'bottom' | 'center' | {number}（y坐标，单位px）
	 						        itemWidth:16,
	 						        itemHeight:10,
	 						        data:keyArray
	 						        //图例内容数组，数组项通常为{string}，每一项代表一个系列的name，默认布局到达边缘会自动分行（列），传入空字符串''可实现手动分行（列）。
	 						    },
	 						 */
	 						    toolbox: { 		//工具箱，每个图表最多仅有一个工具箱
	 						        show : true,
	 						        orient : 'horizontal',  //布局方式，默认为水平布局，可选为：'horizontal' | 'vertical'
	 						       showTitle:true,		//是否显示工具箱文字提示，默认启用
	 						      itemSize: 12,
	 						       feature : {    //启用功能，目前支持feature见下，工具箱自定义功能回调处理，try this »
	 						            mark : {show: true},//辅助线标志
	 						            dataView : {show: true, readOnly: false},//数据视图    . readOnly true : 只读的。
	 						            magicType : {
	 						            //动态类型切换，支持直角系下的折线图、柱状图、堆积、平铺转换，上图icon左数6~14，分别是切换为堆积，
	 						            // 切换为平铺，切换折线图，切换柱形图，切换为力导向布局图，切换为和弦图，切换为饼图，切换为漏斗图
	 						                show: true,
	 						                type: ['pie', 'funnel'],//'line', 'bar', 'stack', 'tiled', 'force', 'chord', 'pie', 'funnel'
	 						                option: {     //可传入切换是动态修改的配置，将复写series内的数组项
	 						                    funnel: {
	 						                        x: '30%',
	 						                        width: '50%',
	 						                        funnelAlign: 'left',
	 						                        max: 1548
	 						                    }
	 						                }
	 						            },
	 						            restore : {show: true},//还原，复位原始图表，上图icon右数2
	 						            saveAsImage : {show: true}//保存图片（IE8-不支持），上图icon最右，可设置更多属性
	 						        }
	 						    },
	 						    calculable : true,//是否启用拖拽重计算特性，默认关闭，相关的还有 calculableColor， calculableHolderColor， nameConnector， valueConnector）
	 						    series : [
	 						        {
	 						            name:text,//系列名称，如启用legend，该值将被legend.data索引相关
	 						            type:'pie',//图表类型，必要参数！如为空或不支持类型，则该系列数据不被显示。可选为：
	 												//'line'（折线图） | 'bar'（柱状图） | 'scatter'（散点图） | 'k'（K线图）
	 												//'pie'（饼图） | 'radar'（雷达图） | 'chord'（和弦图） | 'force'（力导向布局图） | 'map'（地图）
	 						            radius : '65%',//半径，支持绝对值（px）和百分比，百分比计算比，min(width, height) / 2 * 75%， 传数组实现环形图，[内半径，外半径]
	 						            //相对于包裹图表的div。直径所占的百分比。
	 						            center: ['50%', '50%'],//圆心坐标，支持绝对值（px）和百分比，百分比计算min(width, height) * 50%.
	 						           itemStyle : {   //图形样式
							                normal : { //默认样式
							                    label : {
							                        show : false
							                    },
							                    labelLine : {
							                        show : false
							                    }
							                },
							                emphasis : {   //强调样式（悬浮时样式）
							                    label : {
							                        show : false
							                    },
							                    labelLine : {  //标签视觉引导线，默认显示
							                        show : false
							                    }
							                }
							            },
	 						           
	 						            data:data
	 						        }
	 						    ]
	 						};
	 		        myChart.setOption(option);
	 	            
	 	        }
	 	    );
		
	     
	}
	
	
	
	
	
	
	
	
	
	